﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Test_Bitmap
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            //"D:\rose\rose.jpg"  从磁盘上复制的路径需要多加一个\  
            //否则会报错
            Bitmap img = new Bitmap("D:\\rose\\rose.jpg");
            int w = img.Width;
            int h = img.Height;
            pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox1.Image = img;
            pictureBox1.Dock = DockStyle.Fill;
        
        }
       // pictureBox1 是通过工具箱添加的控件， 不是new出来的 
    }
}
